@extends('backstage.layout.master')
@section('title', '售后列表')
@section('style')
        <!-- page specific plugin styles -->
<meta name="_token" content="{{csrf_token()}}"/>
<link rel="stylesheet" href="/assets/css/jquery-ui-1.10.3.custom.min.css"/>
<link rel="stylesheet" href="/assets/css/chosen.css"/>
<link rel="stylesheet" href="/assets/css/datepicker.css"/>
<link rel="stylesheet" href="/assets/css/bootstrap-timepicker.css"/>
<link rel="stylesheet" href="/assets/css/daterangepicker.css"/>
<link rel="stylesheet" href="/assets/css/colorpicker.css"/>
<!-- fonts -->
<style>
	#outExcel{
		top:40px;
	}
	.state li{
		list-style:none;
		float:left;
		padding:0 20px;
		text-align:center;
		height:40px;
		line-height:40px;
	}
	.state li a:hover{color:#4D4DB3}
	.state li a{
		color:#668B8B;
		text-decoration:none;
		outline:none;
		blr:expression(this.onFocus=this.blur());
	}
	.curBg{
		background:#4D4DB3;
		height:3px;
		position:absolute;
		width:68px;
		left:35px;
	}
	.state{
		width:px;
		margin:0 auto;
		posiition:relative;
	}
	.cls{clear:both;}
	.state .cur a{
		color:#4D4DB3;
	}
</style>
@stop
@section('script')
	<script src="backstage/assets/js/date-time/bootstrap-datepicker.min.js"></script>
    <script src="backstage/assets/js/date-time/bootstrap-timepicker.min.js"></script>
    <script src="backstage/assets/js/date-time/moment.min.js"></script>
    <script src="backstage/assets/js/date-time/daterangepicker.min.js"></script>
    <script type="text/javascript">
		$('input[name=date-range-picker]').daterangepicker().prev().on(ace.click_event, function(){
                $(this).next().focus();
         });
		function findOrderBy(){
			var column	= $("#column option:selected").val();
			var value	= $("#"+column).val();
			var str		= "";
			if(value != "" && value != undefined){
				str	   += column+"="+value;
			}

			var column1 = $("#column1 option:selected").val();
			var value1  = $("#"+column1+" option:selected").val();
			if(value1 != "" && value1 != undefined && str.length>0){
				str	   += "&"+column1+"="+value1;
			}else if(value1 != "" && value1 != undefined && str.length==0){
				str    += column1+"="+value1;
			}

            var column2 = $("#column2 option:selected").val();
            var value2  = $("#"+column2).val();
            if(value2 != "" && value2 != undefined && str.length>0){
                str    += "&"+column2+"="+value1;
            }else if(value2 != "" && value2 != undefined && str.length==0){
                str    += column2+"="+value2;
            }

			window.location.href="/backstage/order/aftermark-list?"+str;
		}


    </script>
@stop
@section('content')
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try {
                ace.settings.check('breadcrumbs', 'fixed')
            } catch (e) {
            }
        </script>

        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="#">主页</a>
            </li>

            <li class="active">
                <a href="backstage/order/aftermarks">售后列表</a>
            </li>
            <li>
                售后列表
            </li>
        </ul><!-- .breadcrumb -->
    </div>

    <div class="page-content">
        <div class="page-header">
            <h1>
                售后
                <small>
                    <i class="icon-double-angle-right"></i>
                    售后列表
                </small>
            </h1>
			<!-- <div class="nav-search" id="nav-search">

				<button id="outExcel" class="btn" onclick="createExcel();" data="{{isset($_SERVER['QUERY_STRING'])?$_SERVER['QUERY_STRING']:''}}">
					导出订单
				</button>
				<a href="" id="downExcel" style="display:none;" download="">
					下载
				</a>

			</div>#nav-search -->
        </div>
        <div class="row">

			<div class="nav-search col-xs-12" style="position: static;height: 50px;" id="nav-search">
				<select id="column" style="width:113px;">
					<option value ="order_id">订单编号</option>
				</select>
				<span class="input-icon" style="width: 209px;">
					<input type="text" class="form-control" id="order_id" autocomplete="off"
					placeholder="{{isset($_GET['order_id'])&&$_GET['order_id']!=''?$_GET['order_id']:''}}"/>
				</span>

			</div><!-- #nav-search -->

            <div class="nav-search col-xs-12" style="position: static;height: 50px;" id="nav-search">
                <select id="column1" style="width:113px;">
                    <option value ="state">售后单状态</option>
                </select>
                <span class="input-icon" style="width: 209px;">
                    <select id="state"  style="width: 209px;">
                        <option value=""></option>
                        <option value="0" @if(isset($_GET['state']) && $_GET['state'] == 0) selected = "selected" @endif>审核未通过</option>
                        <option value="1" @if(isset($_GET['state']) && $_GET['state'] == 1) selected = "selected" @endif>审核中</option>
                        <option value="2" @if(isset($_GET['state']) && $_GET['state'] == 2) selected = "selected" @endif>审核通过</option>
                        <option value="3" @if(isset($_GET['state']) && $_GET['state'] == 3) selected = "selected" @endif>返货中</option>
                        <option value="4" @if(isset($_GET['state']) && $_GET['state'] == 4) selected = "selected" @endif>官方已收货</option>
                        <option value="5" @if(isset($_GET['state']) && $_GET['state'] == 5) selected = "selected" @endif>处理中</option>
                        <option value="6" @if(isset($_GET['state']) && $_GET['state'] == 6) selected = "selected" @endif>官方已寄回</option>
                        <option value="7" @if(isset($_GET['state']) && $_GET['state'] == 7) selected = "selected" @endif>买家已收货</option>
                    </select>
                </span>

            </div><!-- #nav-search -->

			<div class="nav-search col-xs-12" style="position: static;height: 50px;" id="nav-search">

				<select id="column2"  style="width:113px;">
					<option value ="time_range">时间段</option>
				</select>
				<span class="input-icon" style="width: 209px;">
                    <input class="form-control" style="cursor:pointer;" type="text" name="date-range-picker" readonly id="time_range"
                    placeholder="{{isset($_GET['time_range'])&&$_GET['time_range']!=''?$_GET['time_range']:''}}"/>
                </span>
				<button class="btn" onclick="findOrderBy();" >
					搜索
				</button>
			</div><!-- #nav-search -->
            <div class="col-xs-12">

                <div class="table-responsive">
                    <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <th>订单编号</th>
                            <th>收货人</th>
                            <th>服务类型</th>
							<th>订单支付金额</th>
							<th>申请时间</th>
							<th>处理进度</th>
                            <th>操作</th>
                        </tr>
                        </thead>

                        <tbody>
						@if(!isset($afters)||count($afters)==0)
						<tr class="">暂时没有数据</tr>
						@else
                        @foreach ($afters as $after)
                        <tr>
                            <td>{{isset($after->order_id)?$after->order_id:''}}</td>
                            <td>
                                {{isset($after->rece->consignee) ? $after->rece->consignee : ''}}[TEL:{{isset($after->rece->phone)?$after->rece->phone:''}}]
                                <br>
                                {{isset($after->rece->address) ? $after->rece->address : ''}}
                            </td>
							<td>
                                @if(isset($after->type) && $after->type == 1)
                                退货
                                @elseif(isset($after->type) && $after->type == 2)
                                换货
                                @else
                                未知
                                @endif
                            </td>
							<td>
								{{isset($after->total_fee)?$after->total_fee:''}}
							</td>
							<td>
								{{isset($after->created_at)?date('Y-m-d H:i:s',$after->created_at):''}}
							</td>
                            <td>
								@if(isset($after->state) && $after->state == 0)
                                审核未通过
                                @elseif(isset($after->state) && $after->state == 1)
                                审核中
                                @elseif(isset($after->state) && $after->state == 2)
                                审核通过
                                @elseif(isset($after->state) && $after->state == 3)
                                返货中
                                @elseif(isset($after->state) && $after->state == 4)
                                官方已收货
                                @elseif(isset($after->state) && $after->state == 5)
                                处理中
                                @elseif(isset($after->state) && $after->state == 6)
                                官方已寄回
                                @elseif(isset($after->state) && $after->state == 7)
                                买家已收货
                                @else
                                未知
                                @endif
                            </td>


                            <td>
								<ul class="nav-pills" style="list-style-type:none">
									<li class="dropdown all-camera-dropdown">
										<a target="_blank" href="/backstage/order/after-detail?order_after_id={{$after->order_after_id}}">
                                            <span id="app_users_selections_contacts_1">查看</span>
                                        </a>
						            </li>
								</ul>
                            </td>
                        </tr>
                        @endforeach
						@endif
                        </tbody>
                    </table>
                </div>
				@if(!isset($orders))
				@else
                <div class="row">
                    <div class="col-sm-6">
                        <div class="dataTables_info" id="sample-table-2_info"></div>
                    </div>
                    <div class="col-sm-6">
                        <div class="dataTables_paginate paging_bootstrap">
                            <?php echo $afters->render(); ?>
                        </div>
                    </div>
                </div>
				@endif
                <!-- PAGE CONTENT ENDS -->
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.page-content -->
@stop
